@extends('layouts.main')
@section('title', "通讯录列表")
@section('content')
    <style>
        .table tbody tr td {
            vertical-align: middle
        }
    </style>
    <div class="panel panel-default">
        <div class="panel-heading">
            通讯录列表
        </div>
        <div class="panel-heading">
            <a class="btn btn-primary" href="{{route('user.create.show')}}"><i class="fa fa-user"></i>新 增</a>
        </div>
        <div class="panel-heading">
            <form action="{{route('user.list')}}" method="get">
                搜索条件：
                姓名：<input type="text" name="name" value="{{request('name')}}">
                电话号码：<input type="text" name="telephone" value="{{request('telephone')}}">
                <button type="submit" class="btn btn-xs btn-info">点击搜索</button>
            </form>
        </div>
        <table class="table">
            <thead>
            <tr>
                <th>ID</th>
                <th>姓名</th>
                <th>工作单位</th>
                <th>电话号码</th>
                <th>Email地址</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($users as $user)
                <tr>
                    <td>{{$user->id}}</td>
                    <td>{{$user->name}}</td>
                    <td>{{$user->company}}</td>
                    <td>{{$user->telephone}}</td>
                    <td>{{$user->email}}</td>
                    <td>{{$user->created_at}}</td>
                    <td>
                        <a class="btn btn-info" href="{{route('user.update.show',['id'=>$user->id])}}"><i
                                    class="fa fa-user"></i> 修改</a>
                        <a class="btn btn-danger" onclick="javascript:if(confirm('确实要删除吗?')){return true}return false;"
                           href="{{route('user.delete.post',['id'=>$user->id])}}"><i class="fa fa-lock"></i> 删除</a>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>

        <footer class="panel-footer">
            <div class="row">
                <div class="text-center">
                <small class="text-muted inline m-t-sm m-b-sm">当前显示 {{ $users->firstItem() }}
                -{{ $users->lastItem() }} 共 {{ $users->total() }} 条
                </small>
                </div>
                <div class="text-left">
                    {{ $users->links() }}
                </div>
            </div>
        </footer>
    </div>
@endsection